/* eslint-disable class-methods-use-this */
import {
  get,
  put,
} from '@/lin/plugins/axios'

// 我们通过 class 这样的语法糖使模型这个概念更加具象化，其优点：耦合性低、可维护性。
class Auth {
  // constructor() {}

  async getRealList(page, limit, info) {
    const res = await get(`v1/auth/real?page=${page}&limit=${limit}`, info)
    return res
  }

  async getRealInfo(id) {
    const res = await get(`v1/auth/real/${id}`)
    return res
  }

  async updateReal(info) {
    const res = await put('v1/auth/real', info)
    return res
  }

  async getEducationList(page, limit, info) {
    const res = await get(`v1/auth/education?page=${page}&limit=${limit}`, info)
    return res
  }

  async getEducationInfo(id) {
    const res = await get(`v1/auth/education/${id}`)
    return res
  }

  async updateEducation(info) {
    const res = await put('v1/auth/education', info)
    return res
  }

  async getJobList(page, limit, info) {
    const res = await get(`v1/auth/job?page=${page}&limit=${limit}`, info)
    return res
  }

  async getJobInfo(id) {
    const res = await get(`v1/auth/job/${id}`)
    return res
  }

  async updateJob(info) {
    const res = await put('v1/auth/job', info)
    return res
  }

  async getIncomeList(page, limit, info) {
    const res = await get(`v1/auth/income?page=${page}&limit=${limit}`, info)
    return res
  }

  async getIncomeInfo(id) {
    const res = await get(`v1/auth/income/${id}`)
    return res
  }

  async updateIncome(info) {
    const res = await put('v1/auth/income', info)
    return res
  }

  async getAssetsList(page, limit, info) {
    const res = await get(`v1/auth/income?page=${page}&limit=${limit}`, info)
    return res
  }

  async getAssetsInfo(id) {
    const res = await get(`v1/auth/assets/${id}`)
    return res
  }

  async updateAssets(info) {
    const res = await put('v1/auth/assets', info)
    return res
  }
}

export default new Auth()
